#!/bin/bash
#%depends: dmroot
#%provides: tuda_debug
#%programs: /usr/sbin/sshd /usr/bin/tee /sbin/nologin /usr/bin/strace /usr/bin/busybox
#%stage: block
#Author: Geert Geurts, geert.geurts@hrz.tu-darmstadt.de
(
echo "Running tuda_debug.sh..."

. /lib/tuda-lib.sh
DEBUG=$(getarg tuda_debug)
if [ "$DEBUG" == "1" ]; then
	echo "Starting sshd..."
	/usr/sbin/sshd&
elif [ "$DEBUG" == "2" ]; then
	echo "Starting sshd and waiting for logout after debug..."
	/usr/sbin/sshd&
	while [ ! -e /tmp/continue_boot ]; do
		sleep 30
	done
fi
)2>&1 |tee /tmp/tuda_debug.log
